﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Quan_ly_thong_tin_he_thong
{
    public partial class XemThongTinPhongBan : Form
    {
        public XemThongTinPhongBan()
        {
            InitializeComponent();
        }

        private void loadDataGridView()
        {
            string connectionstring = @"Data Source=THAI-PC\SQLEXPRESS;Initial Catalog=TrangSuc;Integrated Security=True";
            SqlConnection conn = new SqlConnection(connectionstring);
            string sql = "select * from PhongBan";
            SqlCommand cmd = new SqlCommand(sql, conn);
            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                dataGridView1.Rows.Add(new string[] { reader["MaSo_PB"].ToString(), (string)reader["Ten_PB"],});
            }
            reader.Close();
            conn.Close();
        }

        private void XemThongTinPhongBan_Load(object sender, EventArgs e)
        {
            loadDataGridView();
        }
    }
}
